
package cn.by.wms.controller;

import cn.by.wms.entity.Permission;
import cn.by.wms.entity.RolePermission;
import cn.by.wms.entity.Roles;
import cn.by.wms.entity.UserRole;
import cn.by.wms.service.RolePermissionService;
import cn.by.wms.service.UserRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//Restful Api
@RestController
@RequestMapping("/api/permission")
@Slf4j
public class UserPermissionController {

    @Autowired
    private RolePermissionService  rolePermissionService ;


    @GetMapping
    public List<RolePermission> selectRole(RolePermission permission ) {
        return rolePermissionService.select( permission);
    }
    @GetMapping("/permissionList")
    public List<Permission> insert( Permission permission){
        return rolePermissionService.selectPermission(permission);
    }

//    @PostMapping("/addRole")
//    public Integer insert(@RequestBody UserRole userRole){
//        return userRoleService.insert(userRole);
//    }
    @PostMapping()
    public Integer insert(@RequestBody RolePermission rolePermission){
        return rolePermissionService.insert(rolePermission);
    }

//    @PutMapping
//    public Integer update(@RequestBody Category product){
//        return categoryService.update(product);
//    }
//


//    @PostMapping("/deleteRole")
//    public Integer delete(@RequestBody UserRole userRole){
//        return userRoleService.delete(userRole);
//
//    }



}
